package listeners;

import playlistData.PlaylistManager;
import android.view.View;
import android.view.View.OnClickListener;

import com.unipv14.androidgallery.IListsRefresher;
import com.unipv14.androidgallery.R;

public class SoftwareBackButtonListener implements OnClickListener {
	private PlaylistManager manager;
	private IListsRefresher refresher;

	public SoftwareBackButtonListener(PlaylistManager playlistManager,
			IListsRefresher refresher) {
		manager = playlistManager;
		this.refresher = refresher;
	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.backPlaylistButton && !manager.isPlaylistList()) {
			manager.goToPlaylistList();
			refresher.refreshList();
		}
	}
}
